package com.leetcode.LC;

public class LC1588 {
    public int sumOddLengthSubarrays(int[] arr) {

        int sum = 0;
        for (int i = 1; i <= arr.length; i += 2) {
            sum += toSum(arr, i);
        }
        return sum;
    }

    public int toSum(int[] arr, int a) {
        int sum = 0;
        for (int i = 0; i < arr.length - a + 1; i++) {
            for (int j = i; j < i + a; j++) {
                sum += arr[j];
            }
        }
        return sum;
    }
}
